package com.lxy.demo.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lxy.demo.dao.InvitationMapper;
import com.lxy.demo.entity.Invitation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service//service层注解
@Transactional//事务注解
public class InvitationServiceImpl extends ServiceImpl<InvitationMapper,Invitation> implements InvitationService{

    //调用dao层
    @Autowired(required = false)
    private InvitationMapper invitationMapper;

    @Override
    public PageInfo getInvitationListByPB(String searchTitle, Integer pageNum) {
        //开启分页查询
        PageHelper.startPage(pageNum,5);
        //查询
        List<Invitation> list = invitationMapper.selectInvitationBySome(searchTitle);
        //封装
        PageInfo pageInfo = new PageInfo(list);
        return pageInfo;
    }
}
